<?php
/**
 * Created by PhpStorm.
 * User: xieky
 * Date: 2017/6/28
 * Time: 10:49
 */

namespace common\repositories\myhtsq;

use common\repositories\BaseRepository;
use common\entities\myhtsq\ContractProductEntity;

class ContractProductRepository extends BaseRepository
{

    /**
     * 构造方法
     * @param unknown $config (optional)
     */
    public function __construct($config = [])
    {
        parent::__construct($config);
    }


    /**
     * 获取全部产品信息
     * @return array
     */
    public static function getAllContractProduct() {
        return ContractProductEntity::find()->all();
    }

    /**
     * 根据合同id,获取产品信息(充值卡)
     * @param string $contractId 合同id
     * @return string 产品信息
     */
    public static function getProductByContractId($contractId){
        return ContractProductEntity::find()->where(['contract_id'=>$contractId])->all();
    }

}